/*
package com.example.springbootrabbitmq.retreat_message;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.ReturnedMessage;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

*/
/**
 * @BelongsProject: RabbitMQ
 * @BelongsPackage: com.example.springbootrabbitmq.retreat_message
 * @Author: HUI
 * @CreateTime: 2022-04-14 18:56
 * @Description: 回调接口
 *//*

@Component
@Slf4j
public class MyCallBack implements RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnsCallback {

    */
/**
     * 交换机不管是否收到消息的一个回调方法
     * CorrelationData
     * 消息相关数据
     * ack
     * 交换机是否收到消息
     *//*

    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String cause) {
        String id = correlationData != null ? correlationData.getId() : "";
        if (ack) {
            log.info("交换机已经收到 id 为:{}的消息", id);
        } else {
            log.info("交换机还未收到 id 为:{}消息,由于原因:{}", id, cause);
        }
    }



    //当消息无法路由的时候的回调方法
    @Override
    public void returnedMessage(ReturnedMessage returned) {

        log.info("消息：{}，被服务器退回，原因是：{}，交换机是：{}，路由key：{}",
                returned.getMessage().toString(),
                returned.getReplyText(),
                returned.getExchange(),
                returned.getRoutingKey());

    }
}
*/
